package Test;

public class Test1 {
    //获取数字二进制序列的奇数位和偶数位
    //从右往左数
    public static void main(String[] args) {
        int n=7;
        System.out.print("奇数：");

        for (int i = 30; i >=0 ; i-=2) {
            System.out.print(((n >> i) & 1)+" ");
        }
        System.out.println();
        System.out.print("偶数：");

        for (int i = 31; i >=0 ; i-=2) {
            System.out.print(((n >> i) & 1)+" ");
        }
    }
}
